﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufValueInput.h"
#include "GnufListControl.h"

namespace gnuf {

    class GNUF_BASE_EXPORT ListValueInput 
        : public ValueInput<int>
        , public IListControlHandler
    {
        DEFINE_CAST_DERIVED(gnuf::ListValueInput, gnuf::ValueInputBase)
    public:
        explicit ListValueInput(std::uint16_t, std::vector< gcmp::OwnerPtr< Info > > &, int, bool,gcmp::OwnerPtr<Info>&);
        virtual ~ListValueInput();
        ListControl* listControl() { return m_listCtrl.get(); }

    protected:
        // Inherits from ValueInput...
        virtual void onPostValueChanged() override;
        virtual void onPostAbilityChanged() override;

        // Inherits from IListControlHandler...
        virtual int onGetCurrentIndex() const override { return value(); }
        virtual void onCurrentIndexChanged(int) override;

    private:
        gcmp::OwnerPtr< ListControl > m_listCtrl;
    };

}
